package demo2;

/**
 * @Author 12629
 * @Date 2022/4/6 19:40
 * @Description：
 */
//抽象类
abstract class Shape {
    /*public String name;
    public int age;

    public void func() {
        System.out.println("fafa");
    }
    public static void func2() {
        System.out.println("fafa");
    }*/
    public abstract void draw();//抽象方法

}

class Cycle extends Shape {
    @Override
    public void draw() {
        System.out.println("●");
    }
}

/*
abstract class A extends Shape{
    public abstract void func();
}
class B extends A {

    @Override
    public void draw() {

    }

    @Override
    public void func() {

    }
}*/




class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("♦");
    }
}

class Triangle extends Shape {
    @Override
    public void draw() {
        System.out.println("△");
    }
}




public class TestDemo {


    public static void drawMap(Shape shape) {
        shape.draw();
    }

    public static void main(String[] args) {
        //抽象类，不能被实例化
        //Shape shape = new Shape();
        Cycle cycle = new Cycle();
        Rect rect = new Rect();
        Triangle triangle = new Triangle();
        drawMap(cycle);
        drawMap(rect);
        drawMap(triangle);
    }
}
